#!/bin/bash
echo " "
NAME="method spectrum for matrix "$1" with ILU level "$2 
echo "=============================================="
echo $NAME | tee -a names.txt
echo "=============================================="
echo " "
STARTtime=$(date +%s%N)
./ilu --method spectrum --file $1 --ilu-level $2 > "tempspectrum"$2$1".txt"
ENDtime=$(date +%s%N)
CPUTIME=$(tail -1 "tempspectrum"$2$1".txt")
CPUTIME=$(grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}" <<<"$CPUTIME")
DIFF=$((($ENDtime - $STARTtime)/1000000))
echo $DIFF" "$CPUTIME" method spectrum for matrix "$1" with ILU level "$2 >> timings.txt
mv "spectrum.report" "reports/spectrum/spectrum.report"$2"["$1"]"
mv "spectrum.mtx" "reports/spectrum/spectrum"$2"["$1"].mtx"
mv "preconditioned_spectrum.mtx" "reports/spectrum/preconditioned_spectrum"$2"["$1"].mtx"

